package cn.rocksolid.sport.tx.service.impl;

import cn.rocksolid.sport.tx.dao.TxTraceDao;
import cn.rocksolid.sport.tx.entity.TxTraceEntity;
import cn.rocksolid.sport.tx.service.TxTraceService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Isolation;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

@Service
public class TxTraceServiceImpl extends ServiceImpl<TxTraceDao, TxTraceEntity> implements TxTraceService {

  @Override
  @Transactional(propagation = Propagation.REQUIRES_NEW, isolation = Isolation.READ_COMMITTED)
  public TxTraceEntity insert(TxTraceEntity txTraceEntity) {
    getBaseMapper().insert(txTraceEntity);
    return txTraceEntity;
  }

  @Override
  @Transactional(propagation = Propagation.REQUIRES_NEW, isolation = Isolation.READ_COMMITTED)
  public TxTraceEntity update(TxTraceEntity txTraceEntity) {
    getBaseMapper().updateById(txTraceEntity);
    return txTraceEntity;
  }
}
